<script type="text/javascript">
(function(){
	$("#Save").click(function(){
		var oldPwd = $("#PwdOld").val();
		var pwd = $("#PwdNew").val();
		var confirmPwd = $("#PwdCfm").val();
		if ("" == oldPwd){
			showNote(errStr.oldPwdBlank);
			return;
		}

		if ("" == pwd){
			showNote(errStr.newpwdBlank);
			return;
		}

		if (false == checkIllegalChar(pwd)){
			showNote(errStr.newpwdHasInvChr);
			return;
		}

		if (getCNStrLen(pwd) < 5 || getCNStrLen(pwd) > 63){
			showNote(errStr.newpwdLengthErr);
			return;
		}

		if (pwd != confirmPwd){
			showNote(errStr.pwdNotSame);
			return;
		}

		var oldpwdEncoded = new Base64().base64encode(oldPwd);
		var pwdEncoded = new Base64().base64encode(pwd);
		var data = {};
		data.old_password = oldpwdEncoded;
		data.new_password = pwdEncoded;

		apiModify(data, function(result){
			var code = result[ERR_CODE];
			switch(code){
			case E_NONE:
				history.go(-1);
				break;
			case E_UNAUTH:
				showNote(errStr.oldPwdError);
				break;
			case E_INLGVALOLDSAME:
				showNote(errStr.newpwdSameOld);
				break;
			case E_PWDBLANK:
				showNote(errStr.newpwdBlank);
				break;
			case E_PWDLEN:
				showNote(errStr.newpwdLengthErr);
				break;
			case E_PWDILLEGAL:
				showNote(errStr.newpwdHasInvChr);
				break;
			default:
				break;
			}
		});
	});
})();
</script>
<div class="head-con">
	<a href="javascript:history.go(-1);" class="head-btn-l"><i class="head-btn icon icon_back"></i></a>
	<h1 class="head-title">{%label.adminPwd%}</h1>
</div>
<div class="set-con below-head">
	<ul class="blank-bg"></ul>
	<ul class="set-con">
		<label class="desc-lbl">{%label.oldPwd%}</label>
		<li class="text-con">
				<input class="text ime-mode-n hover" maxLength="63" id="PwdOld" value="" />
			<i class="tip icon-eye" data-value="0"></i>
		</li>
	</ul>
	<ul class="set-con">
		<label class="desc-lbl">{%label.newPwd%}</label>
		<li class="text-con">
				<input class="text ime-mode-n hover" maxLength="63" id="PwdNew" value="" placeholder="{%label.pwdLenTip%}" />
			<i class="tip icon-eye" data-value="0"></i>
		</li>
	</ul>
	<ul class="set-con">
		<label class="desc-lbl">{%label.confirmNewPwd%}</label>
		<li class="text-con">
				<input class="text ime-mode-n hover" maxLength="63" id="PwdCfm" value="" placeholder="{%label.pwdLenTip%}" />
			<i class="tip icon-eye" data-value="0"></i>
		</li>
	</ul>
	<ul class="blank-bg"></ul>
	<div class="err-note hidden">
		<i class="err-icon icon_remind_line"></i>
		<p class="note-str"></p>
	</div>
	<div class="btn-con">
		<input id="Save" class="btn" type="button" value="{%btn.save%}" />
	</div>
</div>